<?php

namespace MyBlog\Http\Controllers\desktop;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
use MyBlog\Http\Requests;
use MyBlog\Http\Controllers\Controller;
use MyBlog\Models\Article;
use MyBlog\Models\Category;
use MyBlog\Models\Comment;

class DefaultController extends Controller
{
    public function index() {
    	$categories = Category::where('disabled', false)
    			->where('type', Category::TYPE_ARTICLES)
    			->orderBy('order', 'Asc')->get();
        $articles = Article::orderBy('id', 'DESC')->paginate(10);
        $newComments = Comment::orderBy('id', 'DESC')->take('3')->get();
        $hotArticles = Article::orderBy('read', 'Desc')->take('3')->get();
        
        return View::make('desktop.index', compact('articles', 'categories', 'newComments', 'hotArticles'));
    }
}
